package com.zhonghan.recharge.test;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.zhonghan.common.utils.ExcelUtils;
import com.zhonghan.common.utils.StringUtils;
import com.zhonghan.recharge.pojo.ZhFillCard;
import com.zhonghan.recharge.service.ZhFillCardService;

@Controller
public class testExcel {

	@Autowired
	private ZhFillCardService zfcc;
	
	
	/*@Test
	public void testExcel(){
		
		List<ZhFillCard> zfcList = new ArrayList<>();
		
		Class<ZhFillCard> clazz = ZhFillCard.class;
		File file = new File("D:/1000-40000.xls");
		String[] beanPropertys = {"sequence","password"};
		List<ZhFillCard> list = ExcelUtils.excelParserList(clazz, file, beanPropertys,1);
		for (ZhFillCard z : list) {
			z.getSequence();
			z.getPassword();
			
			z.getFacePrice();
			z.getOverdueTime();
			z.getConsumeTime();
			z.getOutPrice();
			z.getReceiveTelephone();
			z.getCreaterTime();
			z.getStatus();
			
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			z.setPassword(StringUtils.md5EncryptWithSalt(z.getPassword(), "zhonghan"));
			z.setFacePrice(1000);//设置面额
			z.setOverdueTime("2017-12-31");//设置过期时间
			z.setConsumeTime("");//设置消费时间为空
			z.setOutPrice(null);//设置售价
			z.setReceiveTelephone(null);
			z.setCreaterTime(sdf.format(new Date()));
			z.setStatus(0);
			
			zfcList.add(z);
		}
		int result = zfcc.insertZhFillCardByBatch(zfcList);
		System.out.println("导入成功" + result);
	}*/
	
	
}
